<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card class="box-card">
      <el-table :data="rightsList" border style="width: 100%">
        <el-table-column prop="functionCode" label="编号" width="180"></el-table-column>
        <el-table-column prop="functionChina" label="权限名称"></el-table-column>
        <el-table-column prop="urlstring" label="路径"></el-table-column>
        <el-table-column prop="parentCode" label="等级权限">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.parentCode==null">一级</el-tag>
            <el-tag type="success" v-else>二级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  created() {
    this.getRightslist();
  },
  data() {
    return {
      rightsList: []
    };
  },
  methods: {
    getRightslist() {
      this.$get("/api/Function/GetFunction", {})
        .then(res => {
          if (res.code == 0) {
            this.rightsList = res.data;
            console.log(this.rightsList);
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  }
};
</script>

<style lang="stylus" scoped></style>